package edu.nynu.cityeasy.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 积分兑换订单表
 * @TableName points_redemption_order
 */
@TableName(value ="points_redemption_order")
@Data
public class PointsRedemptionOrder implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 订单编号
     */
    private String orderSn;

    /**
     * 下单用户ID (积分扣除对象)
     */
    private Long userId;

    /**
     * 核销/使用房屋ID (用户选择的)
     */
    private Long unitId;

    /**
     * 商品ID (关联 points_product.id)
     */
    private Long productId;

    /**
     * 商品名称 (冗余)
     */
    private String productName;

    /**
     * 消耗积分 (冗余, 防商品价格变动)
     */
    private Integer pointsSpent;

    /**
     * 状态: 待核销, 已完成, 已取消
     */
    private Object status;

    /**
     * 核销码 (用于线下核销)
     */
    private String verificationCode;

    /**
     * 核销人ID (物业员工, 关联 user_account.id)
     */
    private Long verifiedByStaffId;

    /**
     * 核销时间
     */
    private Date verifiedAt;

    /**
     * 
     */
    private Integer isDeleted;

    /**
     * 
     */
    private Date createdAt;

    /**
     * 
     */
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PointsRedemptionOrder other = (PointsRedemptionOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOrderSn() == null ? other.getOrderSn() == null : this.getOrderSn().equals(other.getOrderSn()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getUnitId() == null ? other.getUnitId() == null : this.getUnitId().equals(other.getUnitId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
            && (this.getPointsSpent() == null ? other.getPointsSpent() == null : this.getPointsSpent().equals(other.getPointsSpent()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getVerificationCode() == null ? other.getVerificationCode() == null : this.getVerificationCode().equals(other.getVerificationCode()))
            && (this.getVerifiedByStaffId() == null ? other.getVerifiedByStaffId() == null : this.getVerifiedByStaffId().equals(other.getVerifiedByStaffId()))
            && (this.getVerifiedAt() == null ? other.getVerifiedAt() == null : this.getVerifiedAt().equals(other.getVerifiedAt()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOrderSn() == null) ? 0 : getOrderSn().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getUnitId() == null) ? 0 : getUnitId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getPointsSpent() == null) ? 0 : getPointsSpent().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getVerificationCode() == null) ? 0 : getVerificationCode().hashCode());
        result = prime * result + ((getVerifiedByStaffId() == null) ? 0 : getVerifiedByStaffId().hashCode());
        result = prime * result + ((getVerifiedAt() == null) ? 0 : getVerifiedAt().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", orderSn=").append(orderSn);
        sb.append(", userId=").append(userId);
        sb.append(", unitId=").append(unitId);
        sb.append(", productId=").append(productId);
        sb.append(", productName=").append(productName);
        sb.append(", pointsSpent=").append(pointsSpent);
        sb.append(", status=").append(status);
        sb.append(", verificationCode=").append(verificationCode);
        sb.append(", verifiedByStaffId=").append(verifiedByStaffId);
        sb.append(", verifiedAt=").append(verifiedAt);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}